#define DEBUG
#include <cstdio>
#include <cstdlib>
#include <ctime>
#define MAXN 20
#define MAXT 20
#define MAXA 20

using namespace std;

void makeFile() {
  FILE *out=fopen("a.in", "w");
  int n=rand()%(MAXN-1)+1;
  fprintf(out, "%d\n", n);
  int t=0, a;
  for (int i=1; i<=n; i++) {
    t += rand()%(MAXT-1)+1, a = rand()%(MAXA-1)+1;
    fprintf(out, "%d %d\n", t, a);
  }
  fclose(out);
}

int main() {
  srand(time(0));
  printf("Times:");
  int t;
  scanf("%d", &t);
  for (int i=1; i<=t; i++) {
    makeFile();
    system("./a");
    system("./a_bf");
    if (system("cmp a.out a_bf.out")) {
      printf("WA!");
      return -1;
    }
  }
  return 0;
}
